Skip to content

feat!: Add Builder, make timeout std::time::Duration, add configurable poll_frequency, sleep between checks is relative to timeout#165

Open
LightVillet wants to merge 3 commits intorust-cli:mainfrom
LightVillet:configurable-timeouts
Open

feat!: Add Builder, make timeout std::time::Duration, add configurable poll_frequency, sleep between checks is relative to timeout#165
LightVillet wants to merge 3 commits intorust-cli:mainfrom
LightVillet:configurable-timeouts

Conversation

@LightVillet
Copy link

@LightVillet LightVillet commented Mar 14, 2026

Closes #142
Closes #144

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore!: timeout now has type std::time::Duration

This is not a chore but a fix.

}

/// See `spawn`
pub fn spawn_with_options(command: Command, options: Options) -> Result<PtySession, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is a breaking change but isn't marked as such


/// Process factory, which can be used in order to configure the properties of a command.
#[derive(Default)]
pub struct Builder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally a builder gets named for what it is building, so PtySessionBuilder

#[derive(Default)]
pub struct Builder {
/// A command to spawn
pub(super) command: Option<Command>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub(super) doesn't seem to be needed

Comment on lines +223 to +226
/// Set the command which will be executed
pub fn command(mut self, command: Command) -> Self {
self.command = Some(command);
self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set in new, why are we allowing it to be overridden?

}

/// Set filtering out escape codes, such as colors.
pub fn strip_ansi_escape_codes(mut self) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's accept a bool

#[derive(Default)]
pub struct Builder {
/// A command to spawn
pub(super) command: Option<Command>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why allow an Option<Command> instead of a Command?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this needs a much bigger API re-work than to just add a builder because of the interactions within the different session types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sleeps between timeout checks should be relative to the size of the timeout Configurable sleeps

2 participants